package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Account  string `gorm:"varchar(50);not null;commit:'用户账号'"`
	Password string `gorm:"varchar(50);not null;commit:'用户密码'"`
}

func (u *User) CreatUser(db *gorm.DB) error {
	return db.Create(u).Error
}

func (u *User) FindOrCreat(db *gorm.DB, account string) error {
	return db.Where("account=?", account).FirstOrCreate(u).Error
}
